import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RecruitmentVO, RecruitmentForm, RecruitmentQuery } from '@/api/infopedia/recruitment/types';

/**
 * 查询求职招聘信息列表
 * @param query
 * @returns {*}
 */

export const listRecruitment = (query?: RecruitmentQuery): AxiosPromise<RecruitmentVO[]> => {
  return request({
    url: '/infopedia/recruitment/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询求职招聘信息详细
 * @param id
 */
export const getRecruitment = (id: string | number): AxiosPromise<RecruitmentVO> => {
  return request({
    url: '/infopedia/recruitment/' + id,
    method: 'get'
  });
};

/**
 * 新增求职招聘信息
 * @param data
 */
export const addRecruitment = (data: RecruitmentForm) => {
  return request({
    url: '/infopedia/recruitment',
    method: 'post',
    data: data
  });
};

/**
 * 修改求职招聘信息
 * @param data
 */
export const updateRecruitment = (data: RecruitmentForm) => {
  return request({
    url: '/infopedia/recruitment',
    method: 'put',
    data: data
  });
};

/**
 * 删除求职招聘信息
 * @param id
 */
export const delRecruitment = (id: string | number | Array<string | number>) => {
  return request({
    url: '/infopedia/recruitment/' + id,
    method: 'delete'
  });
};
